Lab 00 - ROS recap

Robotics II

Poznan University of Technology, Institute of Robotics and Machine Intelligence

Laboratory 0: A recap of Robot Operating System (ROS) usage

Back to the course table of contents

Installation

The installation steps for ROS are available in the following links: ROS Melodic for Ubuntu 18.04 or ROS Noetic for Ubuntu 20.04.

Alternatively, you can use prepared containers: osrf/ros:noetic-desktop-full or osrf/ros:melodic-desktop-full.

Basic concepts

Source: https://trojrobert.github.io/hands-on-introdution-to-robot-operating-system(ros)/

Usage

Below are some tips to remind you how to use ROS in the terminal.

Workspace

Frequently, all ROS-related activities are performed in the created directory: ~/catkin_ws/. In this example, the ~/catkin_ws/src/ subdirectory contains the project codes.

catkin_make
source devel/setup.bash

Executions

roscore
roslaunch <PACKAGE_NAME> <LAUNCH_FILE_NAME>
i.e. roslaunch fsds_ros_bridge fsds_ros_bridge.launch
rosrun <PACKAGE_NAME> <EXEC_FILE_NAME>
i.e. rosrun fsds_ros_bridge cameralauncher.py

Topics

rostopic list
  
for example:
  $ rostopic list
  /fsds/camera/cam_mono
  /fsds/control_command
  /fsds/gps
rostopic info <TOPIC_NAME>

for example:
  $ rostopic info /fsds/gps  
  Type: sensor_msgs/NavSatFix

  Publishers: 
  * /fsds/ros_bridge (http://bartosz-PC:44941/)

  Subscribers: None
rostopic echo <TOPIC_NAME>

for example:
  $ rostopic echo /fsds/gps       
  header: 
    seq: 2999
    stamp: 
      secs: 1645038420
      nsecs:  22534000
    frame_id: "fsds/FSCar"
  status: 
    status: 0
    service: 0
  latitude: 47.6414679993
  longitude: -122.140165
  altitude: 122.246520996
  position_covariance: [0.0015999999595806003, 0.0, 0.0, 0.0, 0.0015999999595806003, 0.0, 0.0, 0.0, 0.0015999999595806003]
  position_covariance_type: 0
  ---
rostopic pub <TOPIC_NAME> <MESSAGE_TYPE> <MESSAGE>

for example:
  $ rostopic pub /fsds/control_command fs_msgs/ControlCommand "header:
    seq: 0
    stamp:
      secs: 0
      nsecs: 0
    frame_id: ''
  throttle: 0.0
  steering: 0.0
  brake: 0.0"

Services

rosservice list

for example:
  $ rosservice list
  /fsds/reset
  /fsds/ros_bridge/get_loggers
rosservice info <SERVICE_NAME>

for example:
  $ rosservice info /fsds/reset
  Node: /fsds/ros_bridge
  URI: rosrpc://bartosz-PC:57451
  Type: fsds_ros_bridge/Reset
  Args: waitOnLastTask
rosservice call <SERVICE_NAME> <DATA>

for example:
  $ rosservice call /fsds/reset "waitOnLastTask: false" 
  success: False

Tools

Rosbag

Rosbag allows you to record (rosbag record) and replay (rosbag play) the status of your robotic system.

Rviz

Rviz allows you to visualise topics.

$ rosrun rviz rviz

Rqt_plot

Rqt_plot allows you to draw graphs for topics.

$ rosrun rqt_plot rqt_plot

Rqt_graph

Rqt_graph allows the graphical visualisation of topical calls.

$ rosrun rqt_graph rqt_graph